<!doctype html>
<html class="no-js" lang="">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>作业提交系统V1.0</title>
    <meta name="description" content="作业提交系统V1.0">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.0/normalize.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/lykmapipo/themify-icons@0.1.2/css/themify-icons.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pixeden-stroke-7-icon@1.2.3/pe-icon-7-stroke/dist/pe-icon-7-stroke.min.css">
    <link rel="stylesheet" href="assets/css/cs-skin-elastic.css">
    <link rel="stylesheet" href="assets/css/style.css">
	<!--引入fontawesome-->
	<link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css">
    <!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->

	<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.20.0/axios.min.js"></script>
	
</head>
<body class="bg-dark">

    <div class="sufee-login d-flex align-content-center flex-wrap">
        <div class="container">
            <div class="login-content">
                <div class="login-logo">
                    <a href="#">
                        <i class="fa fa-user-circle fa-5x" aria-hidden="true"></i> 
                    </a>
                </div>
				<div class="text" style="font-size:20px;text-align:center;"><a style="color:#e7e7e7;">欢迎使用索思宣传部作业任务系统</a></div>
				<hr>
                <div class="login-form">
                    <form>
                        <div class="form-group">
                            <label>用户名</label>
                            <input id="username" type="text" class="form-control" placeholder="Username">
                        </div>
                        <div class="form-group">
                            <label>密码</label>
                            <input id="password" type="password" class="form-control" placeholder="Password">
                        </div>
						
						<div class="card-body" align="center">
							<input type="button"   class="btn btn-success" value="登录"     onclick="pri()"></button>	
						</div>
								
                        
                       
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.4/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.1.3/dist/js/bootstrap.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery-match-height@0.7.2/dist/jquery.matchHeight.min.js"></script>
    <script src="assets/js/main.js"></script>
	<script type="text/javascript">
		function loadaccount(){
			//alert("welcome!");
			window.localStorage.clear();
		}
		
		window.onload=loadaccount();
	</script>
	<script type="text/javascript">
		function pri(){
		    var fom1 = document.getElementById('username').value;
			var fom2 = document.getElementById('password').value;
				if(fom1 == "" || fom2 == "") {
					alert("输入错误 请检查.");
				}
			var acc=new Object();
			acc.username=fom1;
			acc.password=fom2;
			//var acc_str=JSON.stringify(acc); 
			//console.log(acc_str);
		   /*
		   axios.post('http://172.81.214.138:8000/student_login',
		     {
		       acc
		     })
		     .then(function (response) {
		       console.log(response);
		     })
		     .catch(function (error) {
		       console.log(error);
		     });*/
			 /*
			 axios({
			 	method: "POST",
			 	url: "http://172.81.214.138:8000/student_login",
			 	headers: {
			 		'Content-Type': 'multipart/form-data' //注意这里
			 	},
			 data: acc
			 }).then((res) => {
			 	console.log(res);
			 	vm.saveFileName = res.data;
				//要在这里缓存username
			 }).catch((err) => {
			 	console.log(err)
			 });*/
			 axios.get(
			 		'http://172.81.214.138:8000/student_login?username='+fom1+'&password='+fom2)
			 	//成功返回
			 	.then(response => {
			 		//User.favorite = response.data.data;
			 		//window.localStorage.setItem("User", JSON.stringify(User));
					console.log(response.data);
					if(response.data.state==1){
						//alert('登陆成功');
						window.localStorage.setItem("SUsername", fom1);//存userName
						window.location.assign('stu-dataOfClass.html');
					}
					else{
						alert('登录失败！');
					}
					
			 	})
			 	//失败返回
			 	.catch(error => {
			 		console.log(error);
			 		
			 	})
		}
	</script>
</body>
</html>
